@extends('orange.layouts.indexPublic')
@section('title'){{$find_jobEn.'_'.Site::get('webname')}} @endsection
{{--简历详情页css--}}
@section('headcss')
    <meta name="keywords" content="{{Site::get('homekeywords')}}">
    <meta name="description" content="{{Site::get('homedescription')}}">
    @parent
    <link rel="stylesheet" href="{{asset('/vendor/jedate/skin/jedate.css')}}">
    <link rel="stylesheet" href="{{asset('/orange/css/index/resume.css')}}">
    <link rel="stylesheet" href="{{asset('/vendor/swiper/skin/swiper2.7.6.css')}}">
@endsection

{{--主体内容--}}
@section('content')
    {{--主导航--}}
    @include('orange.layouts.mainNav')
    {{--主导航结束--}}

    {{--批量浏览简历列表--}}
    @if(!empty($resumelist) && count($resumelist)>0)
        <div class="browse_resumes">
            <div class="wrapper">
                <div class="title">resume</div>
                <ul>
                    @foreach($resumelist as $k => $v)
                        <li id="list{{ $k }}" class="resume_name @if($v->id == $id) resumecheck @endif"><a
                                    href="{{ $v->url }}">{{ $v->name }}</a></li>
                    @endforeach
                    <li class="closeResumes">close</li>
                </ul>
            </div>
        </div>
    @endif
    {{--批量浏览简历列表结束--}}

    {{--主要内容--}}
    <div class="main">
        <div class="wrapper">
            {{--主要内容-简历信息--}}
            <div class="content">
                {{--基本信息--}}
                <div class="baseInfo">
                    <div class="myPhoto">
                          <img src="{{asset($reArrEn['avatar'])}}" alt="简历详情头像">
                    </div>
                    <p class="name">
                        <span class="float_l">
                                @if(!auth()->guard('company')->check())
                                    @if($reArrEn['sex'] == 'Man')
                                        {{ mb_substr($reArrEn['name'],0,10)}} Man
                                    @else
                                        {{ mb_substr($reArrEn['name'],0,10)}} Woman
                                    @endif
                                @else
                                    {{ $reArrEn['name']}}
                                @endif
                        </span>
                    </p>
                    <ul class="details">
                            <li><span class="left">{{ trans('english.sex') }}<i></i></span>{{ $reArrEn['sex']}}</li>
                            <li><span class="left">{{ trans('english.age') }}<i></i></span>{{ $reArrEn['birthday']}}</li>
                            <li><span class="left">{{ trans('english.handSon') }}</span>{{ $reArrEn['work_year']}}</li>
                            <li><span class="left">{{ trans('english.household') }}<i></i></span>{{ $reArrEn['census'] }}</li>
                            <li><span class="left">{{ trans('english.highest') }}</span>{{ $reArrEn['education']}}</li>
                            <li><span class="left">{{ trans('english.livingPlace') }}<i></i></span>{{ $reArrEn['homeaddress'] }}</li>
                            <li><span class="left">{{ trans('english.marital') }}</span>{{ $reArrEn['marital'] }}</li>
                            @if($lookStatus==1)
                                <li><span class="left">{{ trans('english.phone') }}</span>{{ $reArrEn['mobile']}}</li>
                                <li><span class="left">{{ trans('english.Mailbox') }}</span>{{ $reArrEn['email']}}</li>
                            @endif
                    </ul>
                </div>
                {{--基本信息结束--}}

                {{--求职意向--}}
                <div class="intention">
                        <h2><span>{{ trans('english.jobInTension') }}</span></h2>
                        <p><span>{{ trans('english.IntentInd') }}</span>{{ $reArrEn['intentionjobs'] }}</p>
                        <p><span>{{ trans('english.Intention') }}</span>{{ $reArrEn['jobsort'] }}</p>
                        <p><span>{{ trans('english.IntentArea') }}</span>{{ $reArrEn['jobarea'] }}</p>
                        <p><span>{{ trans('english.salary') }}</span>
                            @if($reArrEn['isexpectedsalary'])Negotiable@else{{ $reArrEn['expectedsalary'] }}@endif
                        </p>
                        <p><span>{{ trans('english.JStatus') }}</span>{{ $reArrEn['job_status'] }}</p>

                </div>
                {{--求职意向结束--}}

                {{--自我评价--}}
                @if(!empty($reArrEn['introduction']))
                    <div class="assessment">
                            <h2><span>{{ trans('english.Self') }}</span></h2>
                            <div class="section">
                                <p>{!! nl2br(e($reArrEn['introduction'])) !!}</p>
                            </div>
                    </div>
                @endif
                {{--自我评价结束--}}

                {{--工作经历、教育经历、项目经验--}}
                @if(count($workExpArrEn) > 0)
                    <div class="experience">
                            <h2><span>{{ trans('english.workExperience') }}</span></h2>
                            <div class="section">
                                @foreach($workExpArrEn as $v)
                                    <dl>
                                        <dt>{{$v['industry']}} <span>{{$v['starttime']}}-{{$v['endtime']}}</span></dt>
                                        <dd><span>{{ trans('english.companyName') }}</span>{{$v['company']}}</dd>
                                        <dd>
                                            <span>{{ trans('english.jobDescription') }}</span>
                                            <p>{{$v['content']}}</p>
                                        </dd>
                                    </dl>
                                @endforeach
                            </div>
                    </div>
                @endif
                {{--教育经历--}}
                @if(count($eduExpArrEn) > 0)
                    <div class="experience">
                            <h2><span>{{ trans('english.educate') }}</span></h2>
                            <div class="section">
                                <dl>
                                    @foreach($eduExpArrEn as $v)
                                        <dt>{{$v['school']}} <span>{{$v['starttime']}}-{{$v['endtime']}}</span></dt>
                                        <dd><span>{{ trans('english.nameMajor') }}</span>{{$v['speciality']}}</dd>
                                        <dd><span>{{ trans('english.education') }}</span>{{$v['education']}}</dd>
                                    @endforeach
                                </dl>
                            </div>
                    </div>
                @endif
                {{--项目经验--}}
                @if(count($projectExpArr) > 0)
                    <div class="experience">
                            <h2><span>{{ trans('english.project') }}</span></h2>
                            <div class="section">
                                @foreach($projectExpArr as $v)
                                    <dl>
                                        <dt>{{$v['project_name']}}<span>{{$v['starttime']}}-{{$v['endtime']}}</span></dt>
                                        <dd><span>{{ trans('english.holdOffice') }}</span>{{$v['post']}}</dd>
                                        <dd>
                                            <span>{{ trans('english.ProIntro') }}</span>
                                            <p>{{$v['content']}}</p>
                                        </dd>
                                    </dl>
                                @endforeach
                            </div>
                    </div>
                @endif
                {{--工作经历、教育经历、项目经验结束--}}

                {{--语言能力--}}
                @if(count($languageArrEn) > 0)
                    <div class="languages">
                            <h2><span>{{ trans('english.language') }}</span></h2>
                            <div class="section">
                                @foreach($languageArrEn as $v)
                                    <span>{{$v['language']}}<strong>{{$v['degree']}}</strong><strong>{{$v['level']}}</strong></span>
                                @endforeach
                            </div>
                    </div>
                @endif
                {{--语言能力结束--}}

                {{--技能专长、获得证书--}}
                @if(count($skillArrEn) > 0)
                    <div class="skills">
                            <h2><span>{{ trans('english.expertise') }}</span></h2>
                            <div class="section">
                                @foreach($skillArrEn as $v)
                                    <span>{{$v['skillname']}}<strong>{{$v['degree']}}</strong></span>
                                @endforeach
                            </div>
                    </div>
                @endif
                @if(count($certificateArr) > 0)
                    <div class="skills">
                            <h2><span>{{ trans('english.certificate') }}</span></h2>
                            <div class="section">
                                @foreach($certificateArr as $v)
                                    <span>{{$v['certificate_name']}}</span>
                                @endforeach
                            </div>
                    </div>
                @endif
                {{--技能专长、获得证书--}}

                {{--其他--}}
                @if(count($otherArr) > 0)
                    <div class="experience">
                            <h2><span>{{ trans('english.TheOther') }}</span></h2>
                            <div class="section">
                                @foreach($otherArr as $v)
                                    <dl>
                                        <dt>{{msubstr($v['title'],0,20)}}</dt>
                                        <dd><span></span>{{$v['content']}}</dd>
                                    </dl>
                                @endforeach
                            </div>
                    </div>
                @endif
                {{--其他--}}

                {{--我的作品--}}
                @if(count($worksArr) > 0)
                        <div class="myWorks">
                            <h2><span>{{ trans('english.work') }}</span></h2>
                            <div class="sliderBox swiper-container">
                                <ul class="play-mid-list swiper-wrapper">
                                    @foreach($worksArr as $v)
                                        <li id="liCon{{$v['id']}}" class="swiper-slide swiper-no-swiping">
                                            <input type="hidden" value="{{$v['id']}}">
                                            <input type="hidden" value="{{$v['works_name']}}">
                                            <input type="hidden" value="{{$v['description']}}">
                                            <img src="{{$v['imgurl']}}" width = "265" height = "185" data-id = "{{$v['id']}}" >
                                            <span>{{$v['works_name']}}</span>
                                        </li>
                                    @endforeach
                                </ul>
                            </div>
                            <div class="play-mid-btn play-mid-BL"></div>
                            <div class="play-mid-btn play-mid-BR"></div>
                        </div>
                @endif
                {{--我的作品结束--}}
            </div>
            {{--主要内容-简历信息结束--}}

            {{--侧边栏--}}
            <div class="aside">
                {{--操作--}}
                    <div class="action">
                        @if($lookStatus!=1)
                            <a class="seeContact {{ $look_button }}" href="javascript:void(0)">{{ trans('english.Contact') }}</a>
                        @endif
                        <a class="invite {{ $interview_button }}" href="javascript:void(0)">{{ trans('english.Interview') }}</a>
                        <a class="joinTalentPools {{ $insertPersonnelLibrary_button }}" href="javascript:void(0)">{{ $insertPersonnelLibrary_text }}</a>
                        @if(Auth::guard('company')->check())
                            @if(Auth::guard('company')->user()->resumeNumber() > 1)
                                <a class="resumeDown">{{ trans('english.ResumeDown') }}</a>
                            @else
                                <a class="resumeBuy"{{ trans('english.ResumeDown') }}</a>
                            @endif
                        @endif
                    </div>
                {{--操作结束--}}
                <div class="box">
                    <img src="/default/images/logo/code_weixin.png" alt="微信二维码">
                    <p>打开微信扫一扫，关注一网云CMS</p>
                </div>
            </div>
            {{--侧边栏结束--}}
        </div>
    </div>
    {{--主要内容--}}
    <?php
    ?>
@endsection

{{--简历详情页js--}}
@section('js')
    @parent
    <script type="text/javascript" src="{{ asset('/vendor/swiper/swiper2.7.6.min.js') }}"></script>
    <script type="text/javascript" src="{{ asset("/default/js/jquery/jquery.jedate.js") }}"></script>
    <script type="text/javascript" src="{{ asset('/default/js/jquery/jquery.form.js') }}"></script>
    <script type="text/javascript" src="{{ asset("/orange/js/index/ejectlogin.js") }}"></script>
    <script type="text/javascript" src="{{ asset("/orange/js/index/interview.js") }}"></script>
    <script type="text/javascript" src="{{ asset("/orange/js/index/insertPersonnelLibrary.js") }}"></script>

    <script>
        var photoJson = {!! $photoJson !!};
        $(function(){
            //搜索栏中搜索条件选择
            $('.logoAndSearch select.select').select();

            @if(count($worksArr) > 0)
                @foreach($worksArr as $k => $v)
                    //查看图片
                    $('#liCon' + {{$v['id']}} + ' img').on('click',function(){
                        var imgId = $(this).attr('data-id');
                        rotateImg(photoJson[imgId]);
                    });
                @endforeach
            @elseif(count($worksArr) > 3)
                //创建轮播图
                var mySwiper = new Swiper('.myWorks .swiper-container',{
                    autoplay : 3000,//可选选项，自动滑动
                    loop : true,//可选选项，开启循环
                    slidesPerView: 3, //同时显示的slides数量
                    noSwiping: true, //使该slide无法用鼠标点击滑动
                    cssWidthAndHeight: true, //不自动生成宽高
                    onFirstInit:function(){
                        //swiper-slide鼠标事件
                        $('.myWorks .swiper-slide').mouseenter(function(){//鼠标移上
                            mySwiper.stopAutoplay();
                            $('.myWorks .play-mid-btn').show();
                            //鼠标移开
                            $(this).mouseleave(function(){//鼠标移开
                                mySwiper.startAutoplay();
                                $('.myWorks .play-mid-btn').hide();
                            });
                        });
                        //前进后退按钮鼠标事件
                        $('.myWorks .play-mid-btn').mouseenter(function(){//鼠标移上
                            mySwiper.stopAutoplay();
                            $('.myWorks .play-mid-btn').show();
                            $(this).click(function(){//鼠标点击
                                if($(this).hasClass('play-mid-BL')){
                                    mySwiper.swipePrev();
                                }else{
                                    mySwiper.swipeNext();
                                }
                            });
                            $(this).mouseleave(function(){//鼠标移开
                                mySwiper.startAutoplay();
                            });
                        });
                    }
                });
            @endif

            function rotateImg(photoJson){
                layer.photos({
                    photos: {
                        "title": '', //相册标题
                        "id": '', //相册id
                        "start": 0, //初始显示的图片序号，默认0
                        "data": photoJson
                    },
                    //显示关闭按钮
                    closeBtn: 2,
                    area: 'auto',
                    //设置最大宽度
                    maxWidth: '700',
                    //是否显示拖拽
                    move: false,
                    //设置图片信息
                    tab: function(pic, layero){
                        //console.log(pic) //当前图片的一些信息
                        $('.layui-layer-content').css({'border': '1px solid #444', 'padding': '10px'});
                    },
                    shift: 5 //0-6的选择，指定弹出图片动画类型，默认随机
                });
            }
            //轮播图结束

            //查看联系方式登录按钮
            $(".aside .companylogin").click(function(){
                $.companyEject({
                    className: "companylogin",
                    csrf: "{{ csrf_token() }}",
                    weiXinUrl: "{{ weiXinlogin('company') }}",
                    callBack: function(status){
                        //alert(status);//422 密码错误，0成功，但目前做了 reload
                    }
                });
            });
            //面试邀请登录按钮
            $(".aside .companylogin2").click(function(){
                $.companyEject({
                    className: "companylogin2",
                    csrf: "{{ csrf_token() }}",
                    weiXinUrl: "{{ weiXinlogin('company') }}",
                    callBack: function(status){
                    }
                });
            });
            //纳入人才库登录按钮
            $(".aside .companylogin3").click(function(){
                $.companyEject({
                    className: "companylogin3",
                    csrf: "{{ csrf_token() }}",
                    weiXinUrl: "{{ weiXinlogin('company') }}",
                    callBack: function(status){
                    }
                });
            });
            //绑定查看联系方式
            $(".aside .button1").click(function(){
                $.getContact({
                    userName: "{{ $reArrEn['name']}}",
                    url: "{{url('company/personcontact')}}",
                    crsf: "{{csrf_token()}}",
                    resumeId: "{{ $reArrEn['id'] }}",
                    callBack: function(status){
                        //alert(status);//0您的简历数已用尽，1显示联系方式成功2您的会员时间已过期
                    }
                });
            });
            //绑定面试邀请框
            $(".aside .button2").click(function(){
                $.interview({
                    userName: "{{ $reArrEn['name']}}",
                    url: "{{url('company/inviteinterview')}}",
                    interviewUrl: "{{url('company/interviewnote')}}",
                    postJobUrl: "{{ url("company/jobpublish") }}",
                    crsf: "{{csrf_token()}}",
                    resumeId: "{{ $reArrEn['id'] }}",
                    callBack: function(status){
                        //alert(status);//0发布成功，1您今天已邀请过了，或未选择面试工作2企业未发布工作岗位
                    }
                });
            });
            //绑定纳入人才库
            $(".aside .button3").click(function(){
                $.insertPersonnelLibrary({
                    userName: "{{ $reArrEn['name']}}",
                    url: "{{ route('toShowCompanyJobList') }}",
                    personnelLibraryUrl: "{{ route('insertPersonnelLibrary')}}",
                    postJobUrl: "{{ url("company/jobpublish") }}",
                    delPersonnelLibrary: "{{ route("delPersonnelLibrary") }}",
                    crsf: "{{csrf_token()}}",
                    resumeId: "{{ $reArrEn['id'] }}",
                    callBack: function(status){
                        //alert(status);//0发布成功，1您今天已邀请过了，或未选择面试工作2企业未发布工作岗位
                    }
                });
            });
            //简历下载
            $(".aside .resumeDown").click(function(){
                window.location.href = "{{ route("resume.down",[$reArrEn['id']]) }}";
            });
            //询问是否购买简历数
            $(".aside .resumeBuy").click(function(){
                resumeBuy = layer.confirm('Your membership has expired or your resume has been exhausted', {
                            btn: ['repurchase', 'Buy again later'] //按钮
                        },
                        function(){//success
                            //跳转到vip套餐页面
                            window.open("{{ route("myOrder.index") }}","_blank");
                            layer.close(resumeBuy);
                            orderBuy = layer.confirm('Repurchase?', {btn: ['yes', 'Buy again later'] //按钮
                                    },function(){
                                        window.location.reload();
                                    },
                                    function(){
                                        layer.close(orderBuy);
                                    }
                            );
                        },
                        function(){//false
                            layer.close(resumeBuy);
                        }
                );
            });

            //如果有批量浏览简历导航栏，则执行下面操作
            if($('.browse_resumes').length > 0){
                var height = $('.browse_resumes').outerHeight();
                $('.head').animate({'margin-top':height},300);
                $('.closeResumes').click(function(){
                    $(this).parent().slideUp(500,function(){
                        height = $('.browse_resumes').outerHeight();
                        $('.head').animate({'margin-top':height},500);
                        $('.browse_resumes .title').css('cursor','pointer').on('click.titleClick',function(){
                            $(this).css('cursor','').siblings('ul').slideDown(500,function(){
                                height = $('.browse_resumes').outerHeight();
                                $('.head').animate({'margin-top':height},500);
                                $('.browse_resumes .title').off('.titleClick');
                            });
                        });
                    });
                });
            }

        });
    </script>
@endsection